package com.javaweb.entity;

import java.io.Serializable;
import java.util.Objects;

public class User implements Serializable {
    private int id ;
    private String name ;
    private String pwd ;
    private String img ; // img file name


    public User() {

    }

    public User(String name, String pwd) {
        this.name = name;
        this.pwd = pwd;
    }

    public User(String name, String pwd, String img) {
        this.name = name;
        this.pwd = pwd;
        this.img = img;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof User)) return false;
        User user = (User) o;
        return id == user.id &&
                name.equals(user.name) &&
                pwd.equals(user.pwd);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, pwd);
    }

    @Override
    public String toString() {
        return "User{" +
                "id= " + id +
                "name='" + name + '\'' +
                ", pwd='" + pwd + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }
}
